package com.xugou.service.Impl;

import com.xugou.dao.ClientDao;
import com.xugou.pojo.Client;
import com.xugou.service.ClientService;

import java.util.List;

/**
 * @author xugou
 * @date 2022/6/13  16:17
 */
public class ClientServiceImpl implements ClientService {

    private ClientDao clientDao;

    public void setClientDao(ClientDao clientDao) {
        this.clientDao = clientDao;
    }

    public boolean addClientInfo(Client client) {
        int i = clientDao.addClientInfo(client);
        if (i!=1){
            return false;
        }
        return true;
    }

    public boolean deleteClientById(int id) {
        int i = clientDao.deleteClientById(id);
        if (i!=1){
            return false;
        }
        return true;
    }

    public boolean updateClient(Client client) {
        int i = clientDao.updateClient(client);
        if (i!=1){
            return false;
        }
        return true;
    }

    public Client queryClientById(int id) {
        Client client = clientDao.queryClientById(id);
        if (client==null){
            return null;
        }
        return client;
    }

    public List<Client> getClientList() {
        List<Client> clientList = clientDao.getClientList();
        if (clientList==null){
            return null;
        }
        return clientList;
    }

    public Client queryClientByName(String name) {
        Client client = clientDao.queryClientByName(name);
        if (client==null){
            return null;
        }
        return client;
    }
}
